<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="icon iconfont icon-jifen"></i> 申请列表</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="handle-box">
                <!-- <el-button type="primary" icon="search" @click="search">查询更新状态</el-button> -->
            </div>
            <el-table :data="tableData" border style="width: 100%" >
                <el-table-column prop="id" label="ID" width="80" align="center">
                </el-table-column>
                <el-table-column prop="store_name" label="门店名称" width="200" align="center">
                </el-table-column>
                <el-table-column prop="item_name" label="项目名称" >
                </el-table-column>
                <el-table-column prop="discount_price" label="申请价格" width="170" align="center">
                </el-table-column>
                <el-table-column prop="create_time" label="提交时间" width="170" align="center">
                </el-table-column>
                <el-table-column label="状态" width="150" align="center">
                    <template slot-scope="scope">
                        <div v-if="scope.row.state==0">
                            申请中等待审批
                        </div>
                        <div v-else-if="scope.row.state==1">
                            审批不通过
                        </div>
                        <div v-else-if="scope.row.state==2">
                            审批通过
                        </div>
                        <div v-else-if="scope.row.state==3">
                            申请关闭
                        </div>
                        <div v-else>
                            关闭失效
                        </div>
                        <!-- <el-button size="small" type="text" @click="handleSelect(scope.$index, scope.row)">查看</el-button> -->
                        
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination" v-show="totalPages>10">
                <el-pagination @current-change="handleCurrentChange" layout="prev, pager, next" :total="totalPages">
                </el-pagination>
            </div>
        </div>
       
    </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
    name:"branchPrice",
    data () {
        return {
            pageIndex:1,//当前页码
            pageSize:10,//每页10条
            totalPages:1,//默认的总条数
            title:'',// 新闻标题
            tableData:[],//表格数据
            delVisible:false, //是否显示查看详情弹出层
            delIndex:0,
            delId:0
        }
    },
    computed:{
        ...mapGetters(['userInfo','storeId']),
    },
    mounted() {
        this.$nextTick(function () {
            //获取待处理的数据
            this.getMemberData();
            console.log("获取门店："+this.storeId)
        })
    },
    methods: {
        //获取tabs数据
        getMemberData (){
            const querystring = require('querystring');
            const param ={
                // storeId:1,//门店ID
                storeId:this.storeId,
                pageIndex:this.pageIndex,// 当前页码
                pageSize:this.pageSize //每页大小10
            }
            this.$axios.get('/manage/branch/store/item/applyDiscount/list', {params:param}).then(response=>{
                console.log(response);
                if(response.data.code==200){
                    this.tableData = response.data.data.currData;//赋值 table 列表数据
                    this.totalPages = response.data.data.totalPages;//更新分页总条数
                }else{
                    this.$notify.error({
                        title: '申请列表失败',
                        duration:2000,
                        message: '失败原因：'+response.data.msg
                    });
                }
            })
            .catch(function (response) {
                console.log(response);
            });
        },
        // 分页导航
        handleCurrentChange (val){
            // this.cur_page = val;
            //     this.getData();
        },
        //查询
        search (){
            this.getMemberData();
        }   
    }
}
</script>
<style lang="stylus" scoped>
    .handle-box {
        margin-bottom: 20px;
    }

    .handle-select {
        width: 120px;
    }

    .handle-input {
        width: 300px;
        display: inline-block;
        margin-right :30px;
    }
    .del-dialog-cnt{
        font-size: 16px;
        text-align: center
    }
</style>


